package com.CountDownLatch;

/**
 * Created by mike on 17/10/25.
 */
public class CountDownLatch {
    public void test() throws InterruptedException {
        final java.util.concurrent.CountDownLatch countDownLatch = new java.util.concurrent.CountDownLatch(2);
        new Thread(new Runnable() {
            @Override
            public void run() {
                for(int i=0;i<3;i++) {
                    countDownLatch.countDown();
                    System.out.println("4444444");
                    try {
                        Thread.sleep(13000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

            }
        }).start();

        countDownLatch.await();

        System.out.println("123123123");
    }

    public static void main(String[] args) throws InterruptedException {
        new CountDownLatch().test();
    }
}
